#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, i, j, k;
	cin >> n;
	k = 1;
	for (i = 1; i <= n; ++i)
	{
		for (j = 1; j <= n; ++j)
		{
			if (k / 10 == 0)
			{
				cout << '0';
			}
			cout << k;
			++k;
		}
		cout << '\n';
	}
	cout << '\n';
	for (i = 1; i <= n; ++i)
	{
		for (j = 1; j <= 2 * (n - i); ++j)
		{
			cout << ' ';
		}
		for (k = (i * i - i + 2) / 2; k <= (i * i + i) / 2; ++k)
		{
			if (k / 10 == 0)
			{
				cout << '0';
			}
			cout << k;
		}
		cout << '\n';
	}
	return 0;
}
